package main

import (
	"strconv"

	"github.com/widuu/goini"
)

type ClientConfig struct {
	ServerAddr string
	ServerPort string
}

func NewCliCfg(inipath string) *ClientConfig {
	conf := goini.SetConfig(inipath)

	return &ClientConfig{
		ServerAddr: conf.GetValue("server", "svraddr"),
		ServerPort: conf.GetValue("server", "port"),
	}
}

type MessageData struct {
	Code int    `json:"code"`
	Data string `json:"data"`
	Msg  string `json:"msg"`
}

func StrToInt(s string) int {

	i, e := strconv.Atoi(s)

	if e != nil {
		i = -1
	}

	return i

}
